<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>写评论</title>
    <link rel="stylesheet" href="{{asset('css/reset.css')}}"/>
    <link rel="stylesheet" href="{{asset('css/index.css')}}"/>
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <script src="http://apps.bdimg.com/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    <script src="{{asset('layer/layer.js')}}"></script>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <meta name="baidu-site-verification" content="x1XYMzRXUS" />
</head>
<body>
<!--session检测-->
@if (session()->has('flash_notification.message'))
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        {!! session('flash_notification.message') !!}
    </div>
@endif
<section id="writeComment">
    <form method="post" action="{{url('comment_add_op')}}">
        {{csrf_field()}}
        <input type="hidden" name="a_id" value="{{$a_id}}">
        <input type="hidden" name="p_id" value="{{$p_id}}">
    <textarea placeholder="既然来了,留下点什么吧" id="content" name="content">{{old('content')}}</textarea>
    <div class="form_info">
        <p>
            <img width="20" height="20" src="{{asset('image/ceil.png')}}">
            <span>手机号</span><input type="text" name="tel" value="{{old('tel')}}">
        </p>
        <p>
            <img width="20" height="20" src="{{asset('image/code.png')}}">
            <span>验证码</span><input type="text" name="yzm" value=""><span id="hq">获取验证码</span>
        </p>
    </div>
    <button id="submit" type="submit">提交</button>
    </form>
</section>
<script type="text/javascript">
    $('#hq').click(function () {
        var tel = $('input[name=tel]').val();
        if(!tel)
        {
            layer.msg('手机号不能为空！'); return false;
        }
        $.ajax({
            type : 'GET',
            url : '{{url('api/Empire/yzm')}}'+'/'+tel,
            success: function(data){
                layer.msg(data.message);
            },
            error : function (XMLHttpRequest, textStatus, errorThrown) {
                layer.msg(XMLHttpRequest.responseJSON.message);
            }
        });
    });
    $('div.alert').not('.alert-important').delay(1000).fadeOut(350); //自动隐藏flash
</script>
</body>
</html>